package com.example.shopspring.Model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import jakarta.validation.constraints.*;
import lombok.Data;


@Data
public class CartProduct {

    private int id;
    private int productId;
    private String username;
    private int num;

    private String name;
    private Double price;
    private String description;
    private String genre;

    public CartProduct(Cart cart,Product product){
        this.id=cart.getId();
        this.productId=cart.getProductId();
        this.username=cart.getUsername();
        this.num=cart.getNum();

        this.name=product.getName();
        this.price=product.getPrice();
        this.description=product.getDescription();
        this.genre=product.getGenre();
    }
    public CartProduct(CartProduct cartProduct){
        this.id=cartProduct.getId();
        this.productId=cartProduct.getProductId();
        this.username=cartProduct.getUsername();
        this.num=cartProduct.getNum();

        this.name=cartProduct.getName();
        this.price=cartProduct.getPrice();
        this.description=cartProduct.getDescription();
        this.genre=cartProduct.getGenre();
    }
}
